package com.ingenio.siot.adapter;

import com.ingenio.siot.Adapter;
import com.mysql.jdbc.CallableStatement;
import com.mysql.jdbc.Connection;

public class AlmacenarObservacionesAdapter extends Adapter{

	public void almacenarObservacion(Integer id_movil, Double lat, Double lng, Double vel, String fecha){
		Connection conn = null;
		CallableStatement callableStatement = null;
		String storeProc = "{call InsertarObservacion(?,?,?,?,?)}";
    	try {
			conn = (Connection) abrirConexion();
			callableStatement = (CallableStatement) conn.prepareCall(storeProc);
			callableStatement.setInt(1, id_movil);
			callableStatement.setString(2, fecha);
			callableStatement.setDouble(3, lat);
			callableStatement.setDouble(4, lng);
			callableStatement.setDouble(5, vel);
			callableStatement.executeUpdate();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	finally{
    		cerrarConexion(conn);
    	}
	}
	
}
